﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Imgur.Net.Auth;
using NUnit.Framework;

namespace Imgur.Net.Test.Auth
{
    [TestFixture]
    public class DefaultRegistrationTokenContextTests
    {
        [Test]
        public void CreateInstanceTest()
        {
            string accessToken = "aaaa";
            string refreshToken = "rrrr";
            DateTime expiration = DateTime.Now;

            var instance = new DefaultRegistrationTokenContext(accessToken, refreshToken, expiration);

            Assert.IsNotNull(instance);
            Assert.AreEqual(accessToken, instance.AccessToken);
            Assert.AreEqual(refreshToken, instance.RefreshToken);
            Assert.AreEqual(expiration, instance.Expiration);
        }

        private class TestableRegistrationTokenContext : DefaultRegistrationTokenContext
        {
            public TestableRegistrationTokenContext() : base()
            {
            }
        }

        [Test]
        public void CreateInstanceProtected()
        {
            var instance = new TestableRegistrationTokenContext();

            Assert.IsNotNull(instance);
            Assert.IsNull(instance.AccessToken);
            Assert.IsNull(instance.RefreshToken);

            DateTime initial = new DateTime();
            Assert.AreEqual(initial, instance.Expiration);
        }
    }
}
